<template>
  <a-modal
    :title="title"
    :width="800"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @cancel="handleCancel"
    cancelText="关闭"
    :footer="null">

    <table id="table_report" class="table table-striped table-bordered table-hover">

      <tr>
        <td style="width:90px;text-align: right;padding-top: 80px;">基本信息:</td>
        <td>
          <p style="float: left;">
            停车场名称：<span id="parkName">
              {{ result.parkName }}
            </span><br>

            工作站名称：<span id="workName">
              {{ result.workName }}
            </span><br>

            停车场编号：<span id="parkCode">
              {{ result.parkCode }}
            </span><br>

            <!--            改成文字类型的-->
            终端类型：<span id="terminalType" >
              {{ isTerminalType}}
            </span><br>

            备注：<span id="remark">
              {{ result.remark }}
            </span><br>

            状态：<span id="status" :style="{'color':(result.status === '0' ? 'red' :'green')}">
              {{ result.status==='1'?'在线':'离线' }}
            </span><br>

            最后更新时间：<span id="updateTime">
              {{ result.updateTime }}
            </span><br>

            当班操作员：<span id="operationName">
              {{ result.operationName }}
            </span><br>

            上班时间：<span id="upTime">
              {{ result.upTime }}
            </span><br>

            当前操作员id：<span id="usedUserId">
              {{ result.usedUserId }}
            </span><br>
          </p>
        </td>
      </tr>

      <tr>
        <td style="text-align: center;" colspan="10">
          <a-button type="primary" @click="close">关闭</a-button>
        </td>
      </tr>
    </table>

  </a-modal>
</template>

<script>
import {httpAction,getAction, postAction} from '@/api/manage'

export default {
  name: "ParkWorkStationModalDetail",
  data () {
    return {
      title:"操作",
      visible: false,
      model: {},
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 },
      },
      result: {
      },
      terminalType:'',
      station:{},
      confirmLoading: false,
      form: this.$form.createForm(this),
      validatorRules:{
      },
      url: {
        show: "/parking/parkWorkStation/queryById",
      },
    }
  },
  created () {
  },
  computed:{
    isTerminalType:function (){
      if(this.terminalType===0){
        return '电脑端';
      }
      if(this.terminalType===1){
        return '移动端';
      }
      return '其他';
    }
  },
  methods: {
    edit (record) {
      Object.assign(this.result, record);
      this.initDepart();
      this.visible = true;
    },
    close () {
      this.$emit('close');
      this.visible = false;
    },
    initDepart() {
      getAction(this.url.show, {"id":this.result.id}).then((res) => {
        if (res.success) {
          this.station = res.result;
          this.terminalType=res.result.terminalType;
        }
        if (res.code === 510) {
         return this.$message.warning(res.message)
        }
        this.loading = false;
      })
    },
    handleCancel () {
      this.close()
    },
  }
}
</script>

<style lang="less" scoped>

</style>
